﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

  <!-- This style configures both of the main content areas in the main window. -->
  <Style x:Key="MainHCCStyle" TargetType="{x:Type HeaderedContentControl}">
    <Setter Property="IsTabStop" Value="False" />
    <Setter Property="Template">
      <Setter.Value>
        <!-- This template ensures that content of a HeaderedContentControl fills the available vertical space. -->
        <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
          <DockPanel>
            <ContentPresenter DockPanel.Dock="Top" ContentSource="Header"
                              ContentTemplate="{TemplateBinding HeaderTemplate}" />
            <ContentPresenter ContentSource="Content" ContentTemplate="{TemplateBinding ContentTemplate}" />
          </DockPanel>
        </ControlTemplate>
      </Setter.Value>
    </Setter>
  </Style>

  <!-- This template explains how to render a tab item with a close button.-->
  <DataTemplate x:Key="ClosableTabItemTemplate">
    <DockPanel Margin="5,0">
      <Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="16" DockPanel.Dock="Right"
              Command="{Binding CloseCommand}">
        <Path x:Name="Path" Stretch="Fill" StrokeThickness="0.5" Stroke="#FF333333" Fill="#FF969696"
              Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
              HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
      </Button>
      <TextBlock Text="{Binding ContentViewModel.ViewTitle}" />
    </DockPanel>
  </DataTemplate>

  <DataTemplate x:Key="WorkspaceContentTemplate">
    <ContentPresenter Content="{Binding ContentViewModel}" DataContext="{Binding ContentViewModel}" />
  </DataTemplate>

  <!-- This template explains how to render the 'Workspace' content area in the main window. -->
  <DataTemplate x:Key="WorkspacesTemplate">
    <TabControl IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding}"
                ItemTemplate="{StaticResource ClosableTabItemTemplate}" ContentTemplate="{StaticResource WorkspaceContentTemplate}"
                Margin="4" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"></TabControl>
  </DataTemplate>
</ResourceDictionary>